<template>
	<view class="uiwu-footer-placeholder" :class="isHeight ? 'uiwu-ios' : ''" :style="{height: isHeight ? height : 0}">
		<view class="uiwu-footer-fixed uiwu-ios uiwu-felx uiwu-flex-center" :style="{'background':bgColor}">
			<slot></slot>
		</view>
	</view>
</template>

<script>
	/**
	 * uiwu-footer 底部占位符 兼容ios安全区域 含有匿名插槽
	 * @property {String} height 占位高度 默认100rpx
	 * @property {String} bgColor 背景色 默认 transparent
	 */
	export default {
		name:"uiwu-footer",
		props:{
			height:{
				default:'100rpx',
				type:String
			},
			bgColor:{
				default:'#FFF',
				type:String
			},
			isHeight:{
				default:true,
				type:Boolean
			}
		},
		data() {
			return {
				safeAreaHeigth: 0
			}
		},
		created() {
			this.safeAreaHeigth = uni.getSystemInfoSync().screenHeight - uni.getSystemInfoSync().safeArea.bottom
		}
	}
</script>

<style lang="scss" scoped>
	.uiwu-footer-placeholder{
		width: 100% ;
		height: 100rpx;
		box-sizing: content-box ;
	}
	.uiwu-footer-fixed{
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 10;
	}
	.uiwu-ios{
		padding-bottom: calc(constant(safe-area-inset-bottom)); /*兼容 IOS<11.2*/
		padding-bottom: calc(env(safe-area-inset-bottom)); /*兼容 IOS>11.2*/
		/* #ifdef MP-TOUTIAO */
		padding-bottom: 34px;
		/* #endif */
	}
</style>